package de.hszg.wjl.datacore.model;

import static org.junit.Assert.*;

import org.junit.Test;

import de.hszg.wjl.datacore.model.Statistics.Question;

public class AttachmentQuestionTest extends QuestionTest<AttachmentQuestion> {

	
	private byte[] data = "Das sind Test Daten".getBytes();
	
	@Test
	public void testGetAwnser() {

		AttachmentQuestion question = new AttachmentQuestion();
		question.setData(data);
		assertTrue(question.getAnswer().equals("RGFzIHNpbmQgVGVzdCBEYXRlbg=="));
	}
	
	@Test
	public void testData() {
		AttachmentQuestion question = new AttachmentQuestion();
		question.setData(data);
		assertTrue(question.getData() == data);
	}
	
	
	@Test
	public void testXMLParsing() {
		AttachmentQuestion question = createQuestion();
		assertTrue(question.getType() == QuestionType.ATTACHMENT);
		assertTrue(question.getID().equals("5"));
		assertTrue(question.isRequired());
		assertTrue(question.getText().equals("Attachments"));	
	}

	@Override
	protected String getQuestionXML() {
		return "<question type='attachment' required='true' id='5'><text>Attachments</text></question>";
		
	}

	

}
